package org.ifoc.form.server;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * I extend the DB_Conn abstract class, then I don't have to rewrite code
 * 
 * @author branflake2267
 *
 */
public class DB_Test extends DB_Conn {

	/**
	 * constructor - nothing to do
	 */
	public DB_Test() {
		// nothing to do
	}

	/**
	 * get how many chapters are in a book
	 * 
	 * @param book
	 * @return
	 */
	public int setData(String first, String last) {
		int resultado=0;
		String query = "INSERT INTO test (first, last) VALUES ('"+first+"','"+last+"')";

		try {
			Connection connection = getConn();
			Statement select = connection.createStatement();
			ResultSet result = select.executeQuery(query);

			//rsSize = getResultSetSize(result); // size the array

			// clean up
			result.close();
			connection.close();

		} catch (Exception e) {

			System.err.println("Mysql Statement Error: " + query);
			e.printStackTrace();
			resultado = -1;
		}

		return resultado;
	}
}
